

#Call requires here
#Requires to classes, modules, controllers, routers, and so. 


module TemplateSystem
	
	def getTop(pageName,ext)     #Filename convention : name_TOP_.ext , Str, str
		filename = pageName << '_TOP_' << '.'<<ext
		top = ''
		begin
			file = File.new(filename,"r")
			while (line = file.gets)
				top<<line
			end
			file.close
		rescue => error
			puts "File not Found | Error loading page"
			puts filename
			puts error
		end
		return top   #yeah, I used return, so what?
	end
	
	def getBottom(pageName,ext)           #Filename convention : name_BT_.ext , Str, str
		filename = pageName << '_BT_' << '.'<<ext
		bt = ''
		begin
			file = File.new(filename,"r")
			while (line = file.gets)
				bt<<line
			end
			file.close
		rescue => error
			file = "File not Found | Error loading page"
			puts error
		end
		return bt  #Oh yeah, oh yeah, I used it again.
	end
	
  def getWholeHTML(pagename,ext)
     filename = pagename << "." << ext
     bt = ''
     begin 
       file = File.new(filename,"r")
       while(line = file.gets)
         bt << line
       end
       file.close
     rescue => error
       bt = "FileNotFound"
       puts error
     end
     return bt
   end
	
end
